# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-safe_yaml
_gemname=safe_yaml
pkgver=1.0.5
pkgrel=4
pkgdesc="Parse YAML safely"
url="https://github.com/dtao/safe_yaml"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-rspec ruby-hashie"
source="https://github.com/dtao/safe_yaml/archive/$pkgver/$_gemname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"
options="!check"  # FIXME: tests require gem hashie which we don't have yet

build() {
	gem build $_gemname.gemspec
}

check() {
	rspec .
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r bin cache build_info doc extensions
}

sha512sums="
5ca8472b09e5a463414417355d646e69f4754cb15db21771b45ad7173692dac9ebdfe96ee18659e018fa9b835ce42762c3c61889e127f4f44d658f9d279a1283  safe_yaml-1.0.5.tar.gz
c87b159c5bc34b58066c94b2c40b68c746c73f74bc489585af8b22f96fad5962973b725a4782d7f5b668e09b4cd1ad12f25c7f1e0727caae5b9ff0fca8767cb9  gemspec.patch
"
